package com.stillalive.springioc.controller;

import com.stillalive.springioc.model.DbTypes;
import com.stillalive.springioc.model.Person;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class YmlController {
    // 这里要注意导入的应该是Spring包中的注解
    @Value("${my.key1}")
    private String myKey1;
    @Value("${my.key2}")
    private String myKey2;
    @Autowired
    private Person person;
    @Autowired
    private DbTypes dbTypes;

    @PostConstruct
    public void init(){
        System.out.println("mykey1:" + myKey1);
        System.out.println("mykey2:" + myKey2);
        System.out.println("person:" + person);
        System.out.println("dbTypes:" + dbTypes);
    }
}
